import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.commons.lang3.time.StopWatch;

import cn.hutool.core.util.StrUtil;

public class RemoveRepeat {
	static String abc = "a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e,a,b,c,d,e"; 
	public static void main(String[] args) {
		StopWatch sw = new StopWatch();
		sw.start();
		for (int i = 0; i < 10000; i++) {
			List<String> collect = StrUtil.splitTrim(abc, ",").stream().distinct().collect(Collectors.toList());
			if (i == 0)
				System.out.println("====" + StrUtil.join(",", collect));
		}
		sw.stop();
		System.out.println("jdk8->" + sw.getTime());
		
		sw.reset();sw.start();
		for (int i = 0; i < 10000; i++) {
			Set<String> set = new HashSet<>();
			set.addAll(StrUtil.splitTrim(abc, ","));
			if (i == 0)
				System.out.println("------" + StrUtil.join(",", set));
		}
		sw.stop();
		System.out.println("set->" + sw.getTime());
	}
}
